////
//// Created by liu on 2021/3/15.
////
//
#ifndef PROJECT_ONNX_ONNX_H
#define PROJECT_ONNX_ONNX_H
#include <iostream>
using namespace  std;
#include "onnxruntime_cxx_api.h"
#include <opencv2/opencv.hpp>
struct detector_input{
    const char* model_path;                     // 模型路径
    int batch;                                  // batch
    int channel;                                // 默认3通道
    int net_input_row;                          // 网络输入高
    int net_input_col;
    int net_out_row;                            // 网络输出高
    int net_out_col;
    std::vector<const char*> output_node_names; // 输出层的名字
    vector<const char*> input_layer_names;      // 输入层的名字
};
class detector{
    public:
        explicit  detector(detector_input input);
        unsigned char* get_net_image(unsigned char* image,const int16_t &org_rows,const int16_t &org_cols,const cv::Rect &box);
        void onnx_detect(unsigned char* image, vector<cv::Point_<int>> &kps);
        vector<cv::Point_<int>> kps_to_org( const vector<cv::Point_<int>> kps,const int org_rows , const int org_cols ,const cv::Rect box);
    private:
        Ort::Session* _session{nullptr};
        vector<int64_t> _input_node_dims;
        detector_input in;
        size_t input_tensor_size;
        vector<const char*> _input_layer_names;
        std::vector<const char*> _output_node_names;
};


#endif //PROJECT_ONNX_ONNX_H
